﻿using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WindowsGame1
{
    class PedroSouza2 :Scene
    {
        Player Nave;
        float shotsFired;
        SpriteFont fonte3;
        ReachPoint monster;
        bool l;
        public override void Load(ContentManager Content)
        {
            Animation[] animations = new Animation[1];
            animations[0].name = "Standing";
            animations[0].currentFrame = Vector2.Zero;
            animations[0].frameRate = 1000 / 24;
            animations[0].frameSize = new Vector2(39, 43);
            animations[0].totalFrames = new Vector2(0, 3);
            animations[0].startP = new Vector2(39, 0);

            Nave = new Player(Vector2.Zero, Color.White,
               Content.Load<Texture2D>("ShipSpriteSheet"), animations);

            animations[0].name = "Weak Shot";
            animations[0].currentFrame = Vector2.Zero;
            animations[0].frameRate = 1000 / 24;
            animations[0].frameSize = new Vector2(3, 9);
            animations[0].totalFrames = new Vector2(2, 0);
            animations[0].startP = new Vector2(0, 220);
            Nave.LoadShotManager(10, Content.Load<Texture2D>("AtackSpriteSheet"), animations, 1000);

            fonte3 = Content.Load<SpriteFont>("HUD");
            monster = new ReachPoint(new Vector2(450,250), Color.White, Content.Load<Texture2D>("bloco2"));

        }


        public override void Update(GameTime gameTime)
        {
            Nave.Origem = new Vector2(Nave.Retangulo.Width / 2, Nave.Retangulo.Height / 2);
            Nave.Update(gameTime);
            l = Nave.Collision(monster);
            shotsFired += Nave.Fire(gameTime);
        }
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {   
            
            Nave.Draw(spriteBatch);
            spriteBatch.DrawString(fonte3, "destroy the monster", new Vector2(200f), Color.White);
            if (l)
            {
                spriteBatch.DrawString(fonte3, "You killed the monster", new Vector2(350f), Color.White);
            }
            monster.Draw(spriteBatch);
        }

    }
}
